import QtQuick 2.7
import QtQuick.Controls 2.3
import QtQuick.Layouts 1.3


//Dialog
//Popup{
Dialog{
    id: dialog
    implicitWidth:400
    implicitHeight: 220

    signal okClicked
    signal cancelClicked

    modal:true
    dim:false
    closePolicy:Popup.CloseOnEscape

    MouseArea {
        id:mouseA
        anchors.fill: parent
        property point clickPos: "0,0"
        acceptedButtons: Qt.LeftButton
        onPressed: {
            clickPos  = Qt.point(mouse.x,mouse.y)
        }
        onPositionChanged: {
            var delta = Qt.point(mouse.x-clickPos.x, mouse.y-clickPos.y)
            dialog.x = dialog.x+delta.x
            dialog.y = dialog.y+delta.y
        }
    }

//    background: Image{
//        source:"file:///" + $Path.getPath() + "/resource/photo/popImage/back.png"
//        anchors.fill: parent
//        Rectangle {
//            visible: dialog.visible
//            rotation: 45
//            width: 40
//            height: 40
//            color: "black"
//            //水平居中
//            x:dialog.width/2-5
//        }
//    }
//    Image{
//            source:"file:///" + $Path.getPath() + "/resource/photo/popImage/back.png"
//            anchors.fill: parent
//    }


    footer: DialogButtonBox {
        standardButtons: DialogButtonBox.Ok | DialogButtonBox.Cancel

        onAccepted: {
            emit:okClicked()
        }
        onRejected: {
            emit:cancelClicked()
        }
    }
    onOpened: {
        dialog.focus = true
    }



}
